<?php

use yii\db\Migration;

/**
 * Class m190119_085824_add_regions_tables
 */
class m190119_085824_add_regions_tables extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->execute(file_get_contents(__DIR__.'/mysql/init.sql'));
        $this->execute(file_get_contents(__DIR__.'/mysql/province.sql'));
        $this->execute(file_get_contents(__DIR__.'/mysql/city.sql'));
        $this->execute(file_get_contents(__DIR__.'/mysql/area.sql'));
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
//        echo "m190119_085824_add_regions_tables cannot be reverted.\n";
        $this->dropTable('area');
        $this->dropTable('city');
        $this->dropTable('province');
        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m190119_085824_add_regions_tables cannot be reverted.\n";

        return false;
    }
    */
}
